package com.gem.day10;


public class Phone {
	private String id;
	private double price;
	private String color;
	
	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}
	public Phone(String id, double price) {
		super();
		this.id = id;
		this.price = price;
	}

	public Phone(String id, double price, String color) {
		super();
		this.id = id;
		this.price = price;
		this.color = color;
	}



	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}


	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 31*2+(int)price;
	}

	@Override
	public boolean equals(Object obj) {
		if(this==obj){
			return true;
		}
		if(obj==null){
			return false;
		}
		if(!(obj instanceof Phone)){
			return false;
		}else{
			Phone p=(Phone) obj;
			if((this.getId().equals(p.getId())) && (this.getPrice()==p.getPrice()) && this.getColor().equals(p.getColor())){
				return true;
			}else{
				return false;
			}
		}
	}
	
}
